package com.xiaotu.service.sw.impl;

import com.xiaotu.dao.sw.SwViewsMapper;
import com.xiaotu.model.SwViewsModel;
import com.xiaotu.service.sw.SwViewsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import tk.mybatis.mapper.entity.Example;

/**
 * YAPI分类名称
 * YAPI分类备注/描述
 *
 * @author zhangxiao
 * @module YAPI归属项目
 * @create 2022-01-17 16:22
 */
@Service
@Transactional
public class SwViewsServiceImpl implements SwViewsService {

    @Autowired
    private SwViewsMapper swViewsMapper;

    @Override
    public void insert(SwViewsModel swViewsModel) {
        swViewsMapper.insert(swViewsModel);
    }

    @Override
    public int getSwViews(Integer starId) {
        Example example = new Example(SwViewsModel.class);
        example.createCriteria().andEqualTo("starId", starId);
        return swViewsMapper.selectCountByExample(example);
    }

}
